{% extends 'admin/admin_mould.html' %}

{% block title %}
  registered-info
{% endblock %}

{% block body %}
  <style>
    .form-box {
      margin: 10px 20px 10px 20px;
      text-align: center;
    }

    .input-mag {
      margin: 0 5px 0 5px;
    }
  </style>
  <div class="container">
    <!-- start header -->
    <div class="page-header">
      <h3>{{ domain_name }}
        <small>当前域名竞拍详细信息</small>
        {% if status != '1' %}
          <p style="color: red; font-size: 20px;">抢注已结束</p>
        {% endif %}
      </h3>
    </div>
    <!-- end header -->
    <div class="modify-box">
      <div class="form-box">
        <form class="form-inline" action="/admin/addBase" method="POST">
          <div class="form-group input-mag">
            <input type="text" class="form-control" id="addDoaminName" name="addDoaminName" style="display: none;"
                   value="{{ domain_name }}">
          </div>
          <div class="form-group input-mag">
            <input type="text" class="form-control" id="addBaseTotle" name="addBaseTotle" placeholder="骗人的总(BASE)人数">
          </div>
          <div class="form-group input-mag">
            <input type="text" class="form-control" id="addBasePrice" name="addBasePrice" placeholder="骗人的最高(BASE)价">
          </div>
          <input type="submit" id="AddBase" class="btn btn-primary input-mag" value="修改基值">
          <button type="button" class="btn btn-primary input-mag" data-toggle="modal" data-target="#deleteRE">删除当前抢注</button>
          {% if status == '1' %}
            <button type="button" class="btn btn-primary input-mag" data-toggle="modal" data-target="#endRE" >结束当前抢注</button>
          {% endif %}
        </form>
        <!-- start del domain modal-->
        <div class="modal fade" id="deleteRE" tabindex="-1" role="dialog" aria-labelledby="deleteRELabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h3 class="modal-title" id="deleteRELabel">删除确认</h3>
              </div>
              <div class="modal-body">
                <h3>确认删除此域名抢注</h3>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="delREAJAX">确认删除</button>
              </div>
            </div>
          </div>
        </div>
        <!-- end del domain modal-->

        <!-- start end domain modal-->
        <div class="modal fade" id="endRE" tabindex="-1" role="dialog" aria-labelledby="endRELabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                        aria-hidden="true">&times;</span></button>
                <h3 class="modal-title" id="endRELabel">确认结束</h3>
              </div>
              <div class="modal-body">
                <h3>确认结束此域名抢注</h3>
                <p style="text-align: center; font-size: 16px; color: red;">结束后出价最高的将获得此域名</p>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="endREAJAX">确认结束</button>
              </div>
            </div>
          </div>
        </div>
        <!-- end end domain modal-->
      </div>
      <hr/>
      <div>
        <table class="table table-striped text-center">
          <thead style="font-size: 16px; font-weight: bold;">
          <tr>
            <td>用户名</td>
            <td>邮箱</td>
            <td>电话</td>
            <td>微信</td>
            <td>竞拍价格</td>
          </tr>
          </thead>
          <tbody>
          {% if sort_list == 'error' or info_dic == 'error' %}
            <tr>
              <td colspan="5" class="record-font2">暂无用户抢注</td>
            </tr>
          {% else %}
            {% load registered_info_tr %}
            {% for name_key in sort_list %}
              <tr>
                <td>{{ name_key }}</td>
                <td>{% get_tr_data name_key info_dic 'email' %}</td>
                <td>{% get_tr_data name_key info_dic 'tel' %}</td>
                <td>{% get_tr_data name_key info_dic 'wechat' %}</td>
                <td><span style="color: red;">￥</span>{% get_tr_data name_key info_dic 'price' %}</td>
              </tr>
            {% endfor %}
          {% endif %}
          </tbody>
        </table>
      </div>
    </div>
  </div>
  <script src="/static/js/jquery.min.js"></script>
  <script>
    $('#delREAJAX').click(function () {
        var domain_name = $('#addDoaminName').val();
       $.ajax({
           url : '/admin/delRegistered',
           type : 'POST',
           data: {'domain_name': domain_name},
           datatype: 'JSON'
           }
       );
       location.reload();
    });
     $('#endREAJAX').click(function () {
         var domain_name = $('#addDoaminName').val();
       $.ajax({
           url : '/admin/endRegistered',
           type : 'POST',
           data: {'domain_name': domain_name},
           datatype: 'JSON'
           }
       );
       location.reload();
    });
  </script>
{% endblock %}